const goodsType = {
  localize: {
    search: {
      url: "http://localhost:8080/customer/goods/type/search"
    },
    preset: {
      status: 1,
      userId: 2
    }
  },
  filters: [
    {
      name: "goodsTypeName",
      label: "名称"
    }
  ],
  columns: [
    {
      width: "50",
      label: "#",
      type: "index"
    },
    {
      label: "名称",
      name: "name"
    },
    {
      label: "备注",
      name: "remarks"
    },
    {
      label: "创建时间",
      name: "createAt"
    },
    {
      label: "操作",
      name: "action"
    }
  ],
  actions: [
    {
      title: "新增",
      type: "add",
      target: {
        resourceId: "23"
      }
    }
  ]
};

const goodsTypeDialog = {
  title: "创建物品类型",
  entries: [
    { name: "name", label: "名称" },
    { name: "remarks", label: "备注" }
  ],
  actions: [
    {
      title: "保存",
      type: "submit",
      url: "http://localhost:8080/customer/goods/type"
    },
    { disabled: false, title: "重置", type: "reset" }
  ],
  localize: {
    preset: {
      userId: 1,
      type: 0
    }
  },
  rules: {
    name: [{ required: true, message: "名称不能为空", trigger: "blur" }]
  }
};

const carrierDialog = {
  title: "创建线下承运方",
  entries: [
    { name: "name", label: "承运方名称" },
    { name: "contactName", label: "联系人" },
    { name: "contactMobile", label: "联系电话" }
  ],
  actions: [
    {
      title: "保存",
      type: "submit",
      url: "http://localhost:8080/customer/carrier/offline"
    },
    { disabled: false, title: "重置", type: "reset" }
  ],
  localize: {
    preset: {
      userId: 1,
      type: 0
    }
  },
  rules: {
    name: [{ required: true, message: "承运方名称不能为空", trigger: "blur" }],
    contactName: [
      { required: true, message: "联系人不能为空", trigger: "blur" }
    ],
    contactMobile: [
      { required: true, message: "联系电话不能为空", trigger: "blur" }
    ]
  }
};

const carrierOnline = {
  localize: {
    search: {
      url: "http://localhost:8080/customer/carrier/search"
    },
    preset: {
      type: [1]
    }
  },
  filters: [
    {
      name: "name",
      label: "承运方名称"
    },
    {
      name: "abbr",
      label: "承运方简称"
    },
    {
      name: "contactMobile",
      label: "联系电话"
    },
    {
      name: "contactEmail",
      label: "邮箱"
    },
    {
      name: "contactName",
      label: "联系人"
    },
    {
      name: "status",
      label: "是否有效",
      type: "dictionary",
      options: {
        group: "BooleanType"
      }
    },
    {
      name: "auditStatus",
      label: "审核状态",
      type: "dictionary",
      options: {
        group: "AuditStatus"
      }
    }
  ],
  columns: [
    {
      width: "50",
      label: "#",
      type: "index"
    },
    {
      name: "name",
      label: "承运方名称",
      sortable: true
    },
    {
      name: "abbr",
      label: "承运方简称"
    },
    {
      name: "contactName",
      label: "联系人"
    },
    {
      name: "contactMobile",
      label: "联系电话"
    },
    {
      name: "contactEmail",
      label: "邮箱"
    },
    {
      name: "auditStatusName",
      label: "审核状态"
    },
    {
      name: "statusName",
      label: "是否有效"
    },
    {
      name: "inviteTime",
      label: "邀请时间"
    }
  ],
  actions: []
};

const carrier = {
  localize: {
    search: {
      url: "http://localhost:8080/customer/carrier/search"
    },
    preset: {
      type: [1]
    }
  },
  filters: [
    {
      name: "name",
      label: "承运方名称"
    },
    {
      name: "contactName",
      label: "联系人"
    },
    {
      name: "contactMobile",
      label: "联系电话"
    }
  ],
  columns: [
    {
      width: "50",
      label: "#",
      type: "index"
    },
    {
      name: "name",
      label: "承运方名称",
      sortable: true
    },
    {
      name: "contactName",
      label: "联系人"
    },
    {
      name: "contactMobile",
      label: "联系电话"
    },
    {
      name: "statusName",
      label: "状态"
    },
    {
      name: "createAt",
      label: "创建时间"
    }
  ],
  actions: [
    {
      title: "新增",
      type: "add",
      target: {
        resourceId: "20"
      }
    }
  ]
};

const resource = {
  localize: { search: { url: "http://localhost:16863/dictionary/search" } },
  columns: [
    { width: "50", label: "#", type: "index" },
    { name: "name", label: "名称" },
    { name: "group", label: "组" },
    { name: "value", label: "值" },
    { name: "remarks", label: "备注" },
    { name: "createAt", label: "创建时间" }
  ],
  filters: [
    { name: "name", label: "名称" },
    { name: "group", label: "组", type: "dictionary-group" }
  ],
  actions: [{ title: "新增", type: "add", target: { resourceId: "18" } }]
};

const resourceDialog = {
  actions: [
    { title: "保存", type: "submit", url: "http://localhost:16863/resource" },
    { title: "重置", type: "reset", disabled: false }
  ],
  entries: [
    { label: "名称", name: "name" },
    {
      label: "类型",
      name: "type",
      type: "dictionary",
      options: { group: "ResourceType" }
    },
    { label: "数据", name: "data", type: "object" },
    { type: "textarea", label: "备注", name: "remarks" }
  ],
  title: "新增资源"
};

const dictionaryDialog = {
  title: "新增字典值",
  entries: [
    { name: "name", label: "名称" },
    {
      name: "group",
      options: { "allow-create": true },
      label: "组",
      type: "dictionary-group"
    },
    { name: "value", label: "值" },
    { name: "remarks", label: "备注", type: "textarea" }
  ],
  actions: [
    { title: "保存", type: "submit", url: "http://localhost:16863/dictionary" },
    { disabled: false, title: "重置", type: "reset" }
  ]
};
export {
  resource,
  carrier,
  carrierDialog,
  resourceDialog,
  dictionaryDialog,
  carrierOnline,
  goodsType,
  goodsTypeDialog
};

class ViewData {
  constructor({ dirs, actions, entries }) {
    this.dirs = dirs;
    this.actions = actions;
    this.entries = entries;
  }
}

export { ViewData };
